package com.ruoyi.xh.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.page.TablePageDataInfo;
import com.ruoyi.common.core.domain.CommentResult;
import com.ruoyi.xh.domain.XhOther;
import com.ruoyi.xh.service.IXhOtherService;

/**
 * 其他设置Controller
 *
 * @author songjw
 * @date 2024-12-13
 */
@Api(tags = "其他设置Controller",value = "其他设置Controller")
@RestController
@RequestMapping("/xh/other")
public class XhOtherController extends BaseController {

    @Autowired
    private IXhOtherService xhOtherService;

    /**
     * 查询其他设置列表
     */
    @PreAuthorize("@ss.hasPermi('xh:other:list')")
    @GetMapping("/list")
    @ApiOperation("查询其他设置列表")
    public TablePageDataInfo<XhOther> list(XhOther xhOther) {
        return TablePageDataInfo.success(xhOtherService.selectXhOtherList(xhOther));
    }

    /**
     * 获取其他设置详细信息
     */
    @PreAuthorize("@ss.hasPermi('xh:other:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取其他设置详细信息")
    public CommentResult<XhOther> getInfo(@PathVariable("id") Long id) {
        return CommentResult.success(xhOtherService.selectXhOtherById(id));
    }

    /**
     * 新增其他设置
     */
    @PreAuthorize("@ss.hasPermi('xh:other:add')")
    @Log(title = "其他设置", businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation("新增其他设置")
    public CommentResult<XhOther> add(@RequestBody XhOther xhOther) {
            xhOtherService.insertXhOther(xhOther);
        return CommentResult.success();
    }

    /**
     * 修改其他设置
     */
    @PreAuthorize("@ss.hasPermi('xh:other:edit')")
    @Log(title = "其他设置", businessType = BusinessType.UPDATE)
    @PutMapping
    @ApiOperation("修改其他设置")
    public CommentResult<XhOther> edit(@RequestBody XhOther xhOther) {
            xhOtherService.updateXhOther(xhOther);
        return CommentResult.success();
    }

    /**
     * 删除其他设置
     */
    @PreAuthorize("@ss.hasPermi('xh:other:remove')")
    @Log(title = "其他设置", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    @ApiOperation("删除其他设置")
    public CommentResult<XhOther> remove(@PathVariable Long[] ids) {
            xhOtherService.deleteXhOtherByIds(ids);
        return CommentResult.success();
    }
}
